﻿#ifndef SN_RECORD_MANAGER_H
#define SN_RECORD_MANAGER_H

#include <QtCore/QObject>

#include <QVector>
#include "CommonType.h"

namespace zl {


class SNRecordManager : public QObject
{
public:
    static SNRecordManager* getInstance();
    static void Release();

    // 创建默认SN数据结构
    void GetEmptySNData(SNInfo& snInfo);

    // 保存SN记录
    int32_t SaveSNRecord(SNInfo& snInfo);

    // 删除选中的SN记录
    int32_t RemoveSNRecords(const QStringList& sn_list);

    // 在数据库中查找SN是否已经存过
    int32_t SearchSNRecord(const QString& sn);

    // 在数据库中删除指定SN记录
    int32_t RemoveSNRecord(const QString& sn);

    // 按照条件 查询SN记录信息
    int32_t GetAllSNRecord(
        SNInfoVec& vec,
        const QString& begin_time,
        const QString& close_time,
        const QString account = "",
        const QString sn_info = "");

    int32_t GetComboCompleterInfo(QStringList& account_list, QStringList& sn_info_list);

private:   

    SNRecordManager();
    SNRecordManager(const SNRecordManager &);
    SNRecordManager& operator = (const SNRecordManager &);

    ~SNRecordManager();

private:
    static SNRecordManager* m_instance;

};

} // namespace end

#endif // SN_RECORD_MANAGER_H
